<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <style>
        .login-card {
            border: none;
            border-radius: 1rem;
            box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
        }
        
        .login-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.15);
        }
        
        .login-header {
            border-radius: 1rem 1rem 0 0;
            padding: 1.5rem;
        }
        
        .login-icon {
            animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
            0% {
                transform: scale(1);
            }
            50% {
                transform: scale(1.1);
            }
            100% {
                transform: scale(1);
            }
        }
        
        .form-control {
            border-radius: 0.5rem;
            padding: 0.75rem 1rem;
        }
        
        .form-control:focus {
            box-shadow: 0 0 0 0.25rem rgba(78, 115, 223, 0.25);
        }
        
        .login-btn {
            border-radius: 0.5rem;
            font-weight: 600;
            padding: 0.75rem;
            transition: all 0.3s;
        }
        
        .login-btn:hover {
            transform: translateY(-2px);
        }

        .login-footer {
            border-radius: 0 0 1rem 1rem;
        }
    </style>
</head>
<body>
    <div th:replace="~{layout :: body(content=~{::content})}">
        <div th:fragment="content">
            <div class="row justify-content-center">
                <div class="col-xl-5 col-lg-6 col-md-8">
                    <div class="text-center mb-4">
                        <h1 class="h2 fw-bold">欢迎回来</h1>
                        <p class="text-muted">请登录您的账户访问所有功能</p>
                    </div>
                    
                    <div class="card login-card mb-4">
                        <div class="card-header bg-primary text-white text-center py-4 login-header">
                            <div class="login-icon mb-3">
                                <i class="bi bi-shield-lock" style="font-size: 3.5rem;"></i>
                            </div>
                            <h2 class="fw-bold m-0">用户登录</h2>
                        </div>
                        <div class="card-body p-5">
                            <form th:action="@{/login}" method="post">
                                <div class="mb-4">
                                    <label for="username" class="form-label fw-bold">用户名</label>
                                    <div class="input-group mb-1">
                                        <span class="input-group-text bg-light border-0">
                                            <i class="bi bi-person text-primary"></i>
                                        </span>
                                        <input type="text" class="form-control border-0 bg-light" id="username" name="username" placeholder="请输入用户名" required autofocus>
                                    </div>
                                </div>
                                
                                <div class="mb-4">
                                    <div class="d-flex justify-content-between align-items-center">
                                        <label for="password" class="form-label fw-bold">密码</label>
                                    </div>
                                    <div class="input-group mb-1">
                                        <span class="input-group-text bg-light border-0">
                                            <i class="bi bi-key text-primary"></i>
                                        </span>
                                        <input type="password" class="form-control border-0 bg-light" id="password" name="password" placeholder="请输入密码" required>
                                        <button class="btn bg-light border-0" type="button" id="togglePassword">
                                            <i class="bi bi-eye text-muted"></i>
                                        </button>
                                    </div>
                                </div>
                                
                                <div class="mb-4 form-check">
                                    <input type="checkbox" class="form-check-input" id="remember-me" name="remember-me">
                                    <label class="form-check-label" for="remember-me">保持登录状态</label>
                                </div>
                                
                                <div class="d-grid gap-2 mb-4">
                                    <button type="submit" class="btn btn-primary btn-lg login-btn">
                                        <i class="bi bi-box-arrow-in-right me-2"></i>登录
                                    </button>
                                </div>
                            </form>
                        </div>
                        <div class="card-footer bg-white text-center py-4 login-footer">
                            <div class="mb-1">没有账号？ <a th:href="@{/register}" class="fw-bold text-primary text-decoration-none">立即注册</a></div>
                        </div>
                    </div>
                    
                    <div class="alert alert-light border-0 shadow-sm p-4 text-center">
                        <p class="mb-0"><i class="bi bi-info-circle me-2"></i>演示账号 - 用户: <strong>user</strong>, 密码: <strong>password</strong> | 管理员: <strong>admin</strong>, 密码: <strong>admin</strong></p>
                    </div>
                </div>
            </div>
            
            <script>
                document.addEventListener('DOMContentLoaded', function() {
                    const togglePassword = document.getElementById('togglePassword');
                    const password = document.getElementById('password');
                    
                    togglePassword.addEventListener('click', function() {
                        const type = password.getAttribute('type') === 'password' ? 'text' : 'password';
                        password.setAttribute('type', type);
                        this.querySelector('i').classList.toggle('bi-eye');
                        this.querySelector('i').classList.toggle('bi-eye-slash');
                    });
                });
            </script>
        </div>
    </div>
</body>
</html> 